/**
 * Copyright 2010-2012 Alex Jones
 *
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with i_work for additional information
 * regarding copyright ownership.  The ASF licenses i_file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use i_file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.    
 *
 */

package uk.co.unclealex.hammers.calendar.server.calendar;

import uk.co.unclealex.hammers.calendar.server.calendar.google.GoogleCalendar;
import uk.co.unclealex.hammers.calendar.server.model.Game;


/**
 * An abstract implementation of an {@link UpdateChangeLog} where the game changed is stored.
 * @author alex
 *
 */
public abstract class AbstractGameUpdateChangeLog extends AbstractUpdateChangeLog {

	/**
	 * The game that was changed.
	 */
	private final Game i_game;
	
	/**
	 * Create an update change log that is game aware.
	 * @param googleCalendar The calendar that was changed.
	 * @param game The game that was changed.
	 */
	public AbstractGameUpdateChangeLog(GoogleCalendar googleCalendar, Game game) {
		super(googleCalendar);
		i_game = game;
	}

	/**
	 * {@inheritDoc}
	 */
	@Override
	protected int gameToHashCode() {
		return getGame().hashCode();
	}
 
	/**
	 * {@inheritDoc}
	 */
	@Override
	protected String gameToString() {
		return getGame().toString();
	}

	/**
	 * Gets the game that was changed.
	 * 
	 * @return the game that was changed
	 */
	public Game getGame() {
		return i_game;
	}
}
